#{extends 'common/supervisor.html' /}
#{set title:'CPS推广员列表' /}
<div class="xfht_t_j_k"> 
<!--左-->
#{include "supervisor/networkMarketing/CPSSpreadAction/networkMarketingLeft.control"/}    
<!--右-->
<div class="xn_c_content">
  <div class="xf_ht_tablelist">
  #{form @supervisor.networkMarketing.CPSSpreadAction.CPSAll(), id:'submit'}
  <input type="hidden" id="currPage" name="currPage"/>
  <input type="hidden" id="pageSize" name="pageSize"/>
  <input type="hidden" id="orderType" name="orderType" value="${page?.conditions?.orderType}"/>
  <!-- 搜索 -->
    <div class="xf_ht_search">
      <div class="xf_ht_search_l">
        <span id="div_0" onClick="conditonSearch(0)">默认排序</span>
		<span id="div_1" onClick="conditonSearch(1)">注册时间 <a id="tab_1">↑</a></span>
		<span id="div_3" onClick="conditonSearch(3)">推广会员数 <a id="tab_3">↑</a></span>
		<span id="div_5" onClick="conditonSearch(5)">有效会员占比 <a id="tab_5">↑</a></span>
		<span id="div_7" onClick="conditonSearch(7)">佣金总额 <a id="tab_7">↑</a></span>
      </div>
     </div>
     <div class="xf_ht_search_inon">
       <div class="xf_ht_search_r">
         <div class="xf_ht_search_xl">
           <input name="name" type="text" class="search_w"  value="${page?.conditions?.name}" />
         </div>
         <div class="xf_ht_search_xl">
           <input type="submit" class="search_button" value="搜索">
         </div>
       </div>
     </div>
     #{/form}
	<!-- 列表内容 -->
	<div class="xn_c_content_top">
      #{table class:"xn_c_content_list",cellspacing:"0",cellpadding:"0",border:"0",tr_class_odd:"xn_tr_bj"}
        #{tr}
          #{th}序号#{/th}
          #{th}用户名#{/th}
          #{th}注册时间#{/th}
          #{th}信用等级#{/th}
          #{th}注册时长(天)#{/th}
          #{th}推广会员数#{/th}
          #{th}其中充值会员数#{/th}
          #{th}会员有效占比#{/th}
          #{th}推广会员借款总额#{/th}
          #{th}推广会员的理财总额#{/th}
          #{th}佣金总额#{/th}
          #{th}操作#{/th}
        #{/tr}
        #{list page?.page}
        #{tr tr_index:_index}
          #{td}${(page?.currPage - 1) * page?.pageSize + _index}#{/td}
          #{td}${_?.name}#{/td}
          #{td}${_?.time?.format('yyyy-MM-dd')}#{/td}
          #{td}#{img src:"${_?.credit_level_image_filename}",alt:"",width:"25px",height:"25px"}#{/img}#{/td}
          #{td}${_?.register_length}#{/td}
          #{td}${_?.recommend_count}#{/td}
          #{td}${_?.recharge_count}#{/td}
          #{td}${_?.active_rate}#{/td}
          #{td}${_?.bid_amount?.format("###,##0.00")}#{/td}
          #{td}${_?.invest_amount?.format("###,##0.00")}#{/td}
          #{td}${_?.commission_amount?.format("###,##0.00")}#{/td}
          #{td}<span class="xf_ta_onclick" onClick="CPSDetail('${_?.sign}')">会员明细</span>#{/td}
        #{/tr}
        #{/list}
      #{/table}
    </div>
    <!-- 列表底部 -->
    <div class="xn_c_content_bottom">
        <div class="page_warp">
          #{page currPage:page.currPage,totalCount:page.totalCount,pageSize:page.pageSize,theme:2,style:4/}
        </div>
    </div>
  </div>
</div>
<div class="xn_c_ban_jox xn_c_ban_jox_hyxq" id="showCpaDetail"></div>
</div>
<script type="text/javascript">
function showPagess(currPage, pageSize) {
	  var key = "";
	  $.ajax({
		url : "@{CPSDetail()}",
		type : "POST",
		data : {
		"sign" : g_sign,
		"currPage" : currPage,
		"pageSize" : pageSize,
		"name" : $("#UserName").val(),
		"beginTime" : $("#startDate").val(),
		"endTime" : $("#endDate").val()
		},
		success : function(data) {
		
		  if (data.code < 0) {
	    	alert(data.msg);
			return;
		  }
		  $("#showCpaDetail").html(data);
		  $.layer({
		     type: 1,
		     area: ['850', 'auto'],
		     title: '会员明细',
		     page: {dom : '#showCpaDetail'}
	      });
	    },
		error : function() {
		  alert(data.msg);
		}
	  });
	}



function conditonSearch(num){
  var orderType= ${page?.conditions?.orderType};
  if(orderType == 0){
    $("#orderType").val(num);
    $("#submit").submit();
    return;
  }
  
  var sum = orderType/2;
  if(sum.toString().indexOf('.') == -1){
    var sum2 = orderType - 1;
    if(sum2 == num){
      $("#orderType").val(num);
      $("#submit").submit();
      return;
    }else{
      $("#orderType").val(num);
      $("#submit").submit();
      return;
     }
  }else{
    if(orderType == num){
      $("#orderType").val(num + 1);
      $("#submit").submit();
      return;
    }else{
      $("#orderType").val(num);
      $("#submit").submit();
      return;
       }
     }
   }

$(function(){
  //高亮显示
  showHighLight(1,1,1);
  
  //条件查询控制样式
  var num= ${page?.conditions?.orderType};
  if(num == 0){
    $("#div_0").addClass("xf_sea_isshow");
    return;
  }
       
  var sum = num/2;
  if(sum.toString().indexOf('.') == -1){
    var sum2 = num -1;
    $("#div_"+sum2).addClass("xf_sea_isshow");
    $("#tab_"+sum2).html("↓");
    return;
  }
  
  $("#div_"+num).addClass("xf_sea_isshow");
  $("#tab_"+num).html("↑");
});

var g_sign = 0;
function CPSDetail(sign) {
  g_sign = sign;
  showPagess(1,5);
}
		
function showPage(currPage, pageSize){
    $("#currPage").val(currPage);
    $("#pageSize").val(pageSize);
    $("#submit").submit();
}
</script>